how to quickly set up a mail server on centos7.7

  1. create DNS record

    mail IN A   <IP ADDRESS OF YOUR SERVER>
    @    IN MX   mail.chenshi.de
    
  2. install modoboa

    yum install epel-release -y
    yum install https://centos7.iuscommunity.org/ius-release.rpm -y
    yum install python36u python36u-pip python36u-devel -y
    pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
    pip3 config set global.timeout 60
    pip3 config set global.trusted-host tuna.tsinghua.edu.cn
    pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    cp /root/.config/pip/pip.conf /etc/
    yum install git -y
    git clone https://github.com/modoboa/modoboa-installer
    cd modoboa-installer
    hostnamectl set-hostname chenshi.de
    ./run.py chenshi.de --debug
    
  3. add domain and account

    visit https://mail.chenshi.de/, go to domains tab and click add button to add domain, go to identities tab and click add button to add superAdmins account, after login with new account, don’t forget to delete other accounts.

  4. open port 25 in firewall